
#include "CustomSort.h"
#include <cstdlib>
#include <iostream>

using namespace std;

void sort(int* array, int size) {
    while(!isSorted(array, size)) {
        for (int i=0; i != size; ++i) {
            int j = rand() % size;
            int tmp = array[j];
            array[j] = array[i];
            array[i] = tmp;
        }
    }
}

bool isSorted(int* array, int size) {
    for (int i=1; i != size; ++i) {
        if (array[i-1] > array[i]) return false;
    }

    return true;
}

void print(int* array, int size) {
    for (int i = 0; i != size; ++i) cout << array[i] << " ";
    cout << endl;
}
